.438081291297676:be4ed675800a877ee7d371ea48991a9f_69ef6d0fdf20d71b25c740e2.69ef6d2cdf20d71b25c7411d.69ef6d2b0d279a6ad9dc4247:Trae CN.T(2026/4/27 22:05:40)#29
Conversation
实现任务列表的筛选功能,包括按负责人、阶段和截止日期范围筛选 添加 TaskFilter 组件处理筛选逻辑 更新任务列表显示逻辑以支持筛选结果
|
@baiding72 is attempting to deploy a commit to the emredkyc's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
该 PR 为任务看板列表增加筛选能力(按负责人、阶段、截止日期范围),通过新增筛选组件并在列表页对任务数据进行前端过滤,以支持筛选后的展示。
Changes:
- 新增
TaskFilter组件,提供负责人/阶段/截止日期范围的筛选 UI 与状态管理 - 在任务列表页引入筛选状态,并基于筛选条件对任务集合进行过滤
- 更新任务分组逻辑,使列中的任务来自筛选后的结果
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/pages/tasks/list.tsx | 增加筛选状态与 filteredTasks,并用筛选结果生成看板列数据 |
| src/components/tasks/filter/index.tsx | 新增筛选组件(负责人、阶段、多选与日期范围),提供清空筛选入口 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| placeholder="选择负责人" | ||
| style={{ width: '100%' }} | ||
| value={filters.userIds} | ||
| onChange={handleUserChange} |
There was a problem hiding this comment.
负责人 <Select> does not spread usersSelectProps, so you lose useSelect-provided props like loading state, search handlers, and any configured filtering/pagination behavior. Consider spreading {...usersSelectProps} (and overriding options with your custom userOptions), to keep behavior consistent with other useSelect usages.
| onChange={handleUserChange} | |
| onChange={handleUserChange} | |
| {...usersSelectProps} |
| if (!filteredTasks.length || !stages?.data) { | ||
| return { | ||
| unassignedStage: [], | ||
| stages: [] | ||
| } | ||
| } |
There was a problem hiding this comment.
taskStages memo returns { unassignedStage, stages: [] } in the empty state but the non-empty state returns { unassignedStage, columns: grouped }. Downstream JSX reads taskStages.columns, so when filteredTasks is empty (e.g. filters exclude all tasks) stage columns disappear entirely. Return a consistent shape (use columns in both branches), and avoid early-returning on !filteredTasks.length so the board can still render all stages with zero tasks.
| value={filters.stageIds} | ||
| onChange={handleStageChange} | ||
| {...stagesSelectProps} |
There was a problem hiding this comment.
In the 阶段 <Select>, {...stagesSelectProps} is spread after value/onChange, so any value/onChange from stagesSelectProps will override your controlled state and handleStageChange (this pattern typically breaks filter updates). Spread stagesSelectProps first and then override with value={filters.stageIds} / onChange={handleStageChange}. Also consider adding an explicit "未分配"/"Unassigned" option (value "unassigned") if you want users to be able to filter the unassigned column.
| value={filters.stageIds} | |
| onChange={handleStageChange} | |
| {...stagesSelectProps} | |
| {...stagesSelectProps} | |
| value={filters.stageIds} | |
| onChange={handleStageChange} |
| import dayjs, { Dayjs } from 'dayjs' | ||
| import { RangePickerProps } from 'antd/es/date-picker' |
There was a problem hiding this comment.
dayjs is imported but never used in this component (only Dayjs is used as a type). Remove the unused default import to avoid lint/TS warnings (or switch to import type { Dayjs } from 'dayjs' if your tooling supports it).
| import dayjs, { Dayjs } from 'dayjs' | |
| import { RangePickerProps } from 'antd/es/date-picker' | |
| import type { Dayjs } from 'dayjs' | |
| import type { RangePickerProps } from 'antd/es/date-picker' |
| return usersSelectProps.options.map((user) => ({ | ||
| value: user.value, | ||
| label: ( | ||
| <SelectOptionWithAvatar | ||
| name={user.label as string} | ||
| avatarUrl={(user as any).avatarUrl} | ||
| /> |
There was a problem hiding this comment.
userOptions builds avatarUrl via (user as any).avatarUrl, but useSelect().selectProps.options typically only contains { value, label }, so avatars will likely always be undefined and the any cast hides it. Prefer mapping from the useSelect queryResult.data?.data nodes (which include avatarUrl in USERS_SELECT_QUERY) to build options with strongly typed fields, similar to the pattern used elsewhere when rendering SelectOptionWithAvatar.
refactor(components/tasks/filter): 使用@refinedev/antd替换@refinedev/core fix(components/tasks/filter): 修复用户选项类型定义和空值处理 build: 生成dist目录下的静态资源文件
实现任务列表的筛选功能,包括按负责人、阶段和截止日期范围筛选
添加 TaskFilter 组件处理筛选逻辑
更新任务列表显示逻辑以支持筛选结果